package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ServeclassServe;
import com.api.shopapi.mapper.ServeclassServeMapper;
import com.api.shopapi.service.ServeclassServeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ServeclassServeServiceImplOne")
public class ServeclassServeServiceImpl implements ServeclassServeService {

    @Autowired
    private ServeclassServeMapper serveclassServeMapper;

    @Override
    public int insert(ServeclassServe serveclassServe) {
        return serveclassServeMapper.insert(serveclassServe);
    }

    @Override
    public List<ServeclassServe> getList() {
        return serveclassServeMapper.getList();
    }

    @Override
    public int update(ServeclassServe serveclassServe) {
        return serveclassServeMapper.update(serveclassServe);
    }

    @Override
    public ServeclassServe getByServeclassName(String serveclassName) {
        return serveclassServeMapper.getByServeclassName(serveclassName);
    }

    @Override
    public ServeclassServe getByServeName(String serveName) {
        return serveclassServeMapper.getByServeName(serveName);
    }

    @Override
    public ServeclassServe getByServeclassServeCode(String serveclassServeCode) {
        return serveclassServeMapper.getByServeclassServeCode(serveclassServeCode);
    }

    @Override
    public PageInfo<ServeclassServe> getPageList(int pageIndex, int pageSize, String serveclassName, String serveName) {
        PageHelper.startPage(pageIndex,pageSize);
        List<ServeclassServe> serveList =serveclassServeMapper.getPageList(serveclassName,serveName);
        return new PageInfo<>(serveList);
    }
}
